extends "../qianwei-2/qianwei-2.gd"

func _extInit():
	._extInit()
	lv = 3             #等级的设置
	addSkill("<固化><先手>每10秒，连续突进到5名随机敌人身边发起斩击，造成[三维之和]的可暴击\n炮击伤害，斩击过程中免疫伤害及负面效果", "无敌斩")
var p3 = 10
func _onBattleEnd():
	._onBattleEnd()
	onZhan = false
	flag = 9
var onZhan = false
var flag = 9
func _upS():
	._upS()
	flag += 1
	if flag >= p3:
		wuDiZhan()
		flag = 0
	if not onZhan:return
	for j in buffs:
		if j.isNegetive and j.get("dispel") != 3:
			j.isDel = true

func wuDiZhan():
	utils.createSkillTextEff("无敌斩", position)
	onZhan = true
	for i in range(5):
		tuJi()
		yield(reTimer(1),"timeout")
	onZhan = false

func tuJi():
	for n in range(5):
		var target = utils.getRndEnemy(self)
		if target == null:continue
		var mv = Vector2(target.cell.x, target.cell.y)
		for j in config.aroundCells:
			var v = mv + j
			if matCha(v) == null && sys.main.isMatin(v) and setCell(v):
				var pos = sys.main.map.map_to_world(cell)
				ying(pos)
				position = pos
				createCustEff(sys.main.map.map_to_world(target.cell), "eff/zhan", 8, false, 0.3, Vector2(0, -70))
				aiCha = target
				azurHurtChara(target, att.mgiAtk+att.atk+att.def, sys.HurtType.WEAPON, sys.AtkType.GUN, "无敌斩", true)
				return

func _onHurt(atkInfo):
	._onHurt(atkInfo)
	if onZhan:
		atkInfo.hurtVal = 0